package demo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
 * 使用Spring容器管理将demo1包下所有类交给Context管理
 * 向容器要了一个User对象
 * */
public class Test {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext("demo1");
        User user = context.getBean(User.class);
        user.sayHi();
    }
}
